package com.itmiaojie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itmiaojie.pojo.Link;
import com.itmiaojie.pojo.ResponseResult;
import com.itmiaojie.pojo.vo.LinkVo;
import com.itmiaojie.service.LinkService;
import com.itmiaojie.mapper.LinkMapper;
import com.itmiaojie.utils.BeanCopyUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 */
@Service
public class LinkServiceImpl extends ServiceImpl<LinkMapper, Link>
    implements LinkService{

    @Override
    public ResponseResult getAllLink() throws  Exception {


        LambdaQueryWrapper<Link> queryWrapper = new LambdaQueryWrapper<>();
        //查询所有审核通过的
        queryWrapper.eq(Link::getStatus,"0");
        List<Link> links = baseMapper.selectList(queryWrapper);

        List<LinkVo> linkVos = BeanCopyUtils.copyBeanList(links, LinkVo.class);

        return ResponseResult.okResult(linkVos);
    }
}




